With popularization of portable electronic devices, a user has a stricter requirement for real-time performance and accuracy of location information. Currently, Global Positioning System (GPS) is relatively widely applied. A disadvantage of the GPS lies in that when a GPS receiver moves indoors, because a signal strength affected by a shelter greatly attenuates, positioning accuracy is affected, and a positioning process even cannot be completed. To resolve the foregoing problem, an indoor positioning solution is proposed. For example, a portable electronic device performs positioning by receiving a WI-FI signal sent by an indoor WI-FI access point (AP).
Positioning in a multi-floor building not only relates to planar positioning, but also relates to floor determining. Therefore, how to accurately identify a floor is drawing more attention from a person skilled in the art.
In a solution 1, a portable electronic device identifies a floor using a built-in barometer. A basic principle of determining the floor using the barometer is as follows. An atmospheric pressure value output by the barometer is obtained, an altitude of the portable electronic device is obtained by means of calculation according to a correspondence between an atmospheric pressure value and an altitude, and then a floor on which the portable electronic device is located is determined according to a correspondence between a floor height and an altitude of a building in which the portable electronic device is located.
In a solution 2, a floor is identified using a WI-FI signal. A basic principle is as follows. A portable electronic device receives a WI-FI signal sent by a WI-FI AP, extracts a Media Access Control (MAC) address carried in the WI-FI signal, and then queries a pre-stored mapping relationship between a MAC address and a floor to obtain a floor on which the portable electronic device is located.
However, for the solution 1, on one hand, atmospheric pressure is easily affected by environmental factors such as temperature and humidity, and a correspondence between an altitude and an atmospheric pressure value needs to be frequently adjusted according to an actual situation, to obtain an accurate floor. Implementation is quite complex. On the other hand, correspondences between altitudes and floor heights of different buildings are different, and a correspondence between an altitude and a floor height needs to be adjusted according to different buildings. This is also not easy to implement.
In the solution 2, the portable electronic device in a location may receive WI-FI signals sent by APs on different floors. Consequently, if a floor on which a received WI-FI signal is located is directly used as a floor of the portable electronic device, accuracy of floor identification is extremely low.